from typing import Iterable

from aiogram import Dispatcher, Bot
from loguru import logger
from apscheduler.schedulers.asyncio import AsyncIOScheduler

import config
from sqliter import Database

# TODO go to redis

db = Database('database.db')
logger.add('history.log', rotation='1MB', compression='zip', enqueue=True)
# logger.add('bot_log.log', rotation='1MB', compression='zip', enqueue=True)

# logger.add('bot.log', format="{time:DD-MM-YYYY HH:mm:ss} | {level} | {message}",
#            rotation='1MB', compression='zip', enqueue=True)

bot = Bot(token=config.bot_token, parse_mode="HTML")
dp = Dispatcher()
scheduler = AsyncIOScheduler(timezone='Europe/Kiev')
